//
//  YJModel.m
//  练习
//
//  Created by hcios on 2017/7/5.
//  Copyright © 2017年 hcios. All rights reserved.
//

#import "YJModel.h"
#import "Tools.h"

@implementation YJModel

-(instancetype)initWithDict:(NSDictionary *)dict{
    
    if (self = [super init]) {
        
        _selfID = numberToString(dict[@"id"]);
        _yj_name = NonEmptyString(dict[@"name"]);
        _yj_photos_count = numberToString(dict[@"photos_count"]);
        _yj_start_date = NonEmptyString(dict[@"start_date"]);
        _yj_end_date = NonEmptyString(dict[@"end_date"]);
        _yj_days = numberToString(dict[@"days"]);
        _yj_views_count = numberToString(dict[@"views_count"]);
        _yj_comments_count = numberToString(dict[@"comments_count"]);
        _yj_likes_count = numberToString(dict[@"likes_count"]);
        _yj_front_cover_photo_url = NonEmptyString(dict[@"front_cover_photo_url"]);
        
        _userID = numberToString(dict[@"user"][@"id"]);
        _user_name = NonEmptyString(dict[@"user"][@"name"]);
        _user_image_url = NonEmptyString(dict[@"user"][@"image"]);
        
    }
    return self;
}


-(instancetype)initWithUserDict:(NSDictionary *)dict{
    
    if (self = [super init]) {
        _selfID = numberToString(dict[@"id"]);
        _yj_comments_count = numberToString(dict[@"comments_count"]);
        _yj_end_date = NonEmptyString(dict[@"end_date"]);
        _yj_front_cover_photo_url = NonEmptyString(dict[@"front_cover_photo_url"]);
        _yj_likes_count = numberToString(dict[@"likes_count"]);
        _yj_name = NonEmptyString(dict[@"name"]);
        _yj_start_date = NonEmptyString(dict[@"start_date"]);
        _yj_photos_count = numberToString(dict[@"photos_count"]);
        _yj_days = numberToString(dict[@"days"]);
        _yj_views_count = numberToString(dict[@"views_count"]);
        _user_image_url = NonEmptyString(dict[@"image"]);
    }
    return self;
}

@end
